package com.jyu.apts.dto;

import com.jyu.apts.entity.ItemProcessRecord;
import com.jyu.apts.entity.QRCode;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ItemProcessRecordDto {
	long id;//主键
	ItemProcessDto itemProcess;//流程
	ItemBatchRecordDto itemBatchRecord;//批次信息
	long operatorId;//操作员id
	String createtime;//创建时间
	String operatorNickname;//操作员昵称
	QRCodeDto normalQRCode;
	public ItemProcessRecordDto convert(ItemProcessRecord itemProcessRecord) {
		setId(itemProcessRecord.getId());
		setItemProcess(new ItemProcessDto().convert(itemProcessRecord.getItemProcess()));
		setItemBatchRecord(new ItemBatchRecordDto().convert(itemProcessRecord.getItemBatchRecord()));
		setOperatorId(itemProcessRecord.getOperatorId());
		setOperatorNickname(itemProcessRecord.getOperatorNickname());
		setCreatetime(itemProcessRecord.getCreatetime());
		QRCode normalQRCode = itemProcessRecord.getNormalQRCode();
		if(normalQRCode!=null) {
			setNormalQRCode(new QRCodeDto().convert(normalQRCode));
		}
		return this;
	}
}
